home *** CD-ROM | disk | FTP | other *** search
- {$M 32768,32768,655360} {Stack, minheap, maxheap}
- PROGRAM bbsetup;
-
- (*===========================================================================*)
- (* Set up parameters *)
- (* *)
- (* Copyright 1988, 1989, 1990, 1991, 1992 by H. Roy Engehausen. All *)
- (* rights reserved. *)
- (* *)
- (*===========================================================================*)
-
- {$R+} {Range checking on}
- {$B-} {Boolean complete evaluation off}
- {$S+} {Stack checking on}
- {$I+} {I/O checking on}
- {$V+} {String var checks}
- {$F+} {Must have far calls}
- {$N-} {No numeric coprocessor}
-
- (*===========================================================================*)
- (* Globals *)
- (*===========================================================================*)
-
- USES
- CRT,
- DOS,
- bbdummy,
- bbfsm,
- bbstr2;
-
- (*===========================================================================*)
- (* Imported definitions *)
- (*===========================================================================*)
-
- {$I BBOTYPE.PAS}
- {$I BBTIMEC.PAS}
-
- (*===========================================================================*)
- (* Constants *)
- (*===========================================================================*)
-
- CONST
- out_file_name = 'BBOPT.BB';
- parm_max = 100;
-
- (*===========================================================================*)
- (* Types *)
- (*===========================================================================*)
-
- TYPE
- parm_attr_type = SET OF
- (attr_did_this,
- attr_multiple_ok);
-
- parm_handle_type = RECORD
- parm_attr : parm_attr_type;
- parm_name : STRING[25];
- parm_type : (parm_string,
- parm_string_under,
- parm_string_upper,
- parm_path,
- parm_file_not_exist,
- parm_file,
- parm_log,
- parm_char_upper,
- parm_byte,
- parm_integer,
- parm_word,
- parm_long_int,
- parm_boolean,
- parm_user_class,
- parm_speed,
- parm_port_type,
- parm_obsolete,
- parm_access,
- parm_str_chain,
- parm_str_chain_up);
-
- parm_addr : POINTER;
- parm_str_len : WORD;
-
- parm_lo : LONGINT;
- parm_hi : LONGINT;
-
- END;
-
- parm_array = ARRAY[1..parm_max] OF parm_handle_type;
-
- parm_array_ptr = ^parm_array;
-
- (*===========================================================================*)
- (* Vars *)
- (*===========================================================================*)
-
- VAR
- b : BOOLEAN;
- bell_setting : BOOLEAN;
- code : INTEGER;
- display_sw : BOOLEAN;
- err_sw : BOOLEAN;
- err_save : BOOLEAN;
- fd_cnt : BYTE;
- fsb_flag : BOOLEAN;
- i_byte : LONGINT;
- i_loop : BYTE;
- i_value : LONGINT;
- in_file : TEXT;
- in_file_name : STRING;
- in_line : STRING;
- line_cnt : WORD;
- look : SEARCHREC;
- opt_buffer : opt_file_rec;
- out_file : FILE OF opt_file_rec;
- p_name : STRING;
- p_equal : STRING;
- p_value : STRING;
- port_chain : port_block_ptr;
- port_last_chn : port_block_ptr;
- port_cnt : BYTE;
- port_flag : BOOLEAN;
- port_parm_bcst : BYTE;
- port_parm_call : BYTE;
- port_parm_ring : BYTE;
- t_str : STRING;
- this_port : port_block_ptr;
- this_fsb : fsb_ptr;
- w_count : BYTE;
- work_fsb : file_subsys_block;
- work_port : port_block_type;
- work_str : STRING;
- write_port : port_block_ptr;
-
- main_parm_array : parm_array;
- port_parm_array : parm_array;
- file_parm_array : parm_array;
-
- (*===========================================================================*)
- (* Check to see if this port is all set *)
- (*===========================================================================*)
-
- {$I BBSETUPM.PAS} (* Miscellaneous routines *)
- {$I BBSETUPB.PAS} (* Build beacon info *)
- {$I BBSETUPC.PAS} (* Check port/file *)
- {$I BBSETUPG.PAS} (* Get Parm *)
- {$I BBSETUPP.PAS} (* Process lines *)
- {$I BBSETUP0.PAS} (* Initialize main parms *)
- {$I BBSETUP1.PAS} (* Initialize port parms *)
- {$I BBSETUP2.PAS} (* Initialize file parms *)
-
- (*===========================================================================*)
- (* Main program begins here *)
- (*===========================================================================*)
-
- BEGIN
-
- DIRECTVIDEO := FALSE;
-
- WRITELN;
- WRITELN(this_bbs_version);
- WRITELN;
- WRITELN('Copyright 1988, 1989, 1990, 1991, 1992 by H.R. Engehausen. ');
- WRITELN('All rights reserved. ');
- WRITELN;
-
- (*-------------------------------------------------------------------------*)
- (* Initialize *)
- (*-------------------------------------------------------------------------*)
-
- display_sw := FALSE;
-
- err_sw := FALSE;
-
- port_flag := FALSE;
- port_chain := NIL;
- port_last_chn := NIL;
- port_cnt := 0;
-
- fsb_flag := FALSE;
- fsb_base := NIL;
- fd_cnt := 0;
-
- bell_setting := FALSE;
-
- FILLCHAR(main_parm_array, SIZEOF(main_parm_array), CHR(0));
- FILLCHAR(port_parm_array, SIZEOF(port_parm_array), CHR(0));
- FILLCHAR(file_parm_array, SIZEOF(file_parm_array), CHR(0));
-
- (*-------------------------------------------------------------------------*)
- (* Some fakeouts for general routines *)
- (*-------------------------------------------------------------------------*)
-
- active_tcb := NIL;
-
- (*-------------------------------------------------------------------------*)
- (* Initial settings for main parms *)
- (*-------------------------------------------------------------------------*)
-
- FILLCHAR(opt_block, SIZEOF(opt_block), CHR(0));
-
- WITH opt_block DO
- BEGIN;
-
- opt_hold_dupe_bid := TRUE;
- opt_kill_bbs_error := TRUE;
- opt_direct_display := TRUE;
- opt_direct_snow := TRUE;
- opt_error := TRUE;
- opt_time_status := TRUE;
- opt_blank_to_p := FALSE;
- opt_bid_for_p := TRUE;
- opt_bid_for_t := TRUE;
- opt_bid_for_blank := TRUE;
-
- opt_types := 'BPT';
-
- parm_file_ver := this_bbs_parms;
-
- bcst_interval := 255;
- fwd_delay := 10;
- newuser_l_time := 255;
- wakeup_intervl := 60;
-
- operator_color := default_data_color;
- status_color := default_spec_color;
-
- window_percent := 50;
- scroll_mon := 100;
- scroll_opr := 100;
- scroll_conn := 50;
-
- editor_free := 10000;
-
- bpq_buff := 360;
-
- yapp_time_exp := 1;
-
- END;
-
- (*-------------------------------------------------------------------------*)
- (* Setup parm fields *)
- (*-------------------------------------------------------------------------*)
-
- main_parm_setup;
- port_parm_setup;
- file_parm_setup;
-
- (*-------------------------------------------------------------------------*)
- (* Open the file *)
- (*-------------------------------------------------------------------------*)
-
- in_file_name := '';
-
- FOR i_byte := 1 TO PARAMCOUNT DO
- BEGIN;
-
- in_line := PARAMSTR(i_byte);
- in_line[2] := UPCASE(in_line[2]);
-
- IF in_line = '/D' THEN
- display_sw := TRUE
- ELSE
- BEGIN;
- IF in_file_name <> '' THEN
- BEGIN;
- WRITELN('Bad parameter list');
- HALT;
- END;
- in_file_name := in_line;
- END;
- END;
-
- (*-------------------------------------------------------------------------*)
- (* Open the file *)
- (*-------------------------------------------------------------------------*)
-
- IF in_file_name = '' THEN
- in_file_name := 'PARMS.BB';
-
- ASSIGN(in_file, in_file_name);
-
- {$I-}
- RESET(in_file);
- {$I+}
- IF IORESULT <> 0 THEN
- BEGIN;
- WRITELN('***** Cannot open ', in_file_name);
- HALT;
- END;
-
- (*-------------------------------------------------------------------------*)
- (* Process the lines *)
- (*-------------------------------------------------------------------------*)
-
- line_cnt := 0;
-
- WHILE NOT EOF(in_file) DO
- BEGIN;
- READLN(in_file, in_line);
- IF display_sw THEN
- WRITELN(in_line);
- line_cnt := line_cnt + 1;
-
- work_str := subword(@in_line, 1, 1);
- IF (LENGTH(in_line) > 0)
- AND (work_str[1] <> '*')
- AND (work_str[1] <> ';') THEN
- process_line;
- END;
-
- (*-------------------------------------------------------------------------*)
- (* Close file *)
- (*-------------------------------------------------------------------------*)
-
- CLOSE(in_file);
-
- (*-------------------------------------------------------------------------*)
- (* Check settings *)
- (*-------------------------------------------------------------------------*)
-
- WRITELN;
- WRITELN;
-
- IF port_flag THEN
- err_disp('Missing ENDPORT');
-
- IF fsb_flag THEN
- err_disp('Missing ENDFILE');
-
- IF port_cnt = 0 THEN
- err_line('No ports defined');
-
- WITH opt_block DO
- BEGIN;
- IF max_task_no = 0 THEN
- err_disp('Maximum tasks not set');
- IF this_bb_name[0] = CHR(0) THEN
- err_disp('SYSOP''s name is not set');
- IF this_bb_loc[0] = CHR(0) THEN
- err_disp('This mailbox''s location is not set');
- IF this_bb_sign[0] = CHR(0) THEN
- err_disp('This mailbox''s callsign is not set');
- IF this_bb_addr[0] = CHR(0) THEN
- err_disp('This mailbox''s address is not set');
- IF this_bb_h[0] = CHR(0) THEN
- err_disp('This mailbox''s hierarchical address is not set');
- IF this_bb_h[1] <> '.' THEN
- err_disp('This mailbox''s hierarchical address does not start with a period');
- IF user_file_name[0] = CHR(0) THEN
- err_disp('User file not set');
- IF msg_file_name[0] = CHR(0) THEN
- err_disp('Msg file not set');
- IF msg_file_dir[0] = CHR(0) THEN
- err_disp('Msg directory not set');
- IF mess_fn[0] = CHR(0) THEN
- err_disp('Message text library filename is not set');
- IF route_fn[0] = CHR(0) THEN
- err_disp('Route filename is not set');
- IF path_fn[0] = CHR(0) THEN
- err_disp('Path filename is not set');
- IF help_fn[0] = CHR(0) THEN
- err_disp('Help filename is not set');
- IF dos_mess_fn[0] = CHR(0) THEN
- err_disp('DOS Message filename is not set');
- IF bid_fn[0] = CHR(0) THEN
- err_disp('Bid filename is not set');
- IF n_bid = 0 THEN
- err_disp('Bid maximum is not set');
- IF log_fn[0] = CHR(0) THEN
- err_disp('Log filename is not set');
- IF opt_trace AND (trace_file_name[0] = CHR(0)) THEN
- err_disp('Trace on but file not given');
-
- IF language_list <> '' THEN
- FOR i_loop := 2 TO LENGTH(language_list) DO
- b := test_file(mess_fn + language_list[i_loop], FALSE);
-
- END;
-
- (*-------------------------------------------------------------------------*)
- (* Build beacon info *)
- (*-------------------------------------------------------------------------*)
-
- build_beacon_ports;
-
- (*-------------------------------------------------------------------------*)
- (* If error then quit *)
- (*-------------------------------------------------------------------------*)
-
- IF err_sw THEN
- BEGIN;
- WRITELN(' ');
- WRITELN(' * * * WARNING * * *');
- WRITELN(' ');
- WRITELN('BBSETUP did not complete successfully. The new parameters');
- WRITELN('have been ignored. Correct errors and rerun if you need the');
- WRITELN('new parameters to run successfully');
- WRITELN(' ');
- WRITELN('===> BBOPT.BB has not been changed because of errors <===');
- WRITELN('If you did not have a BBOPT.BB file before, you still don''t');
- WRITELN('have one.');
- WRITELN(' ');
- SOUND(440);
- DELAY(200);
- NOSOUND;
- HALT;
- END;
-
- (*-------------------------------------------------------------------------*)
- (* Some final adjustments please! *)
- (*-------------------------------------------------------------------------*)
-
- WITH opt_block DO
- BEGIN;
-
- z_time_fwd := z_time_fwd * ticks_per_min;
-
- IF home_expires = 0 THEN
- home_expires := 120;
- home_expires := home_expires * ticks_per_day;
-
- IF b_fwd_stop = 0 THEN
- b_fwd_stop := 20;
- b_fwd_stop := b_fwd_stop * ticks_per_day;
-
- IF dflt_b_expire = 0 THEN
- dflt_b_expire := 20;
- dflt_b_expire := dflt_b_expire * ticks_per_day;
-
- IF this_bb_bid = '' THEN
- this_bb_bid := this_bb_sign;
-
- IF sysop_sign = '' THEN
- sysop_sign := this_bb_sign;
-
- IF bell_setting THEN
- BEGIN;
- bell_length1 := 100;
- bell_length2 := 1;
- END
- ELSE
- BEGIN;
- bell_length1 := 1;
- bell_length2 := 5;
- END;
-
- IF (bpq_appl_num > 1) AND (bpq_appl_num < 5) THEN
- bpq_appl_num := 1 SHL (bpq_appl_num-1)
- ELSE
- bpq_appl_num := 1;
-
- END;
-
- (*-------------------------------------------------------------------------*)
- (* Write output file *)
- (*-------------------------------------------------------------------------*)
-
- ASSIGN(out_file, out_file_name);
- REWRITE(out_file);
-
- opt_block.port_count := port_cnt;
- opt_block.fd_count := fd_cnt;
-
- FILLCHAR(opt_buffer, SIZEOF(opt_buffer), CHR(0));
- opt_buffer.opt_block_file := opt_block;
- WRITE(out_file, opt_buffer);
-
- WRITELN('*** Main parameters written ***');
-
- this_port := port_chain;
- write_port := @opt_buffer;
-
- WHILE this_port <> NIL DO
- BEGIN;
- FILLCHAR(opt_buffer, SIZEOF(opt_buffer), CHR(0));
- opt_buffer.opt_port_file := this_port^;
- WITH write_port^ DO
- BEGIN;
- port_sema := 0;
- next_port := NIL;
- rel_port := NIL;
- END;
- WRITE(out_file, opt_buffer);
- this_port := this_port^.next_port;
- END;
-
- WRITELN('*** Port parameters written for ', port_cnt, ' port(s) ***');
-
- this_fsb := fsb_base;
-
- WHILE this_fsb <> NIL DO
- BEGIN;
- FILLCHAR(opt_buffer, SIZEOF(opt_buffer), CHR(0));
- opt_buffer.opt_fd_file := this_fsb^;
- WRITE(out_file, opt_buffer);
- this_fsb := this_fsb^.next_fsb;
- END;
-
- WRITELN('*** File parameters written for ', fd_cnt, ' file directories(s) ***');
-
- CLOSE(out_file);
-
- WRITELN('*** Parameters complete ***');
-
- END.